﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace HuaweiCloud.Dotnet.Samples.Common
{
    public interface IDocCrudApplicationService<T,TCreateDto,TUpdateDto,TDto>
    {
        Task AddAsync(TCreateDto t, CancellationToken token = default);
        Task DeleteAsync<TID>(TID id, CancellationToken token = default) where TID : notnull;
        Task UpdateAsync(TUpdateDto t, CancellationToken token = default);
        Task<TDto?> GetAsync<TID>(TID id, CancellationToken token = default) where TID : notnull;
        Task<List<TDto>> ListAsync(Expression<Func<T, bool>>? filter = null, CancellationToken token = default);
    }
}
